package com.qboot;

import cn.hutool.core.io.FileUtil;

import java.nio.charset.Charset;
import java.util.List;

/**
 * 文档内容生成
 *
 * @author Tellsea
 * @date 2023/2/8
 */
public class ReadmeDoc extends QbootApplicationTests {

    public static void main(String[] args) {
        List<String> lineList = FileUtil.readLines("D:\\Workspace\\IDEAWorkspace\\qboot\\qboot\\qboot-admin\\src\\test\\java\\com\\qboot\\version-java.txt", Charset.defaultCharset());
        System.out.println("|  框架   |  版本  | 框架   |  版本  |");
        System.out.println("| --- | --- | --- | --- |");
        int index = 1;
        for (String line : lineList) {
            String name = line.substring(line.indexOf("<") + 1, line.indexOf("."));
            String version = line.substring(line.indexOf(">") + 1, line.lastIndexOf("<"));
            if (index % 2 != 0) {
                System.out.print("|" + name + "   |   " + version);
            } else {
                System.out.println("|" + name + "   |   " + version + "  |");
            }
            index++;
        }
        System.out.println("---------------------------------------------------------");
        index = 1;
        lineList = FileUtil.readLines("D:\\Workspace\\IDEAWorkspace\\qboot\\qboot\\qboot-admin\\src\\test\\java\\com\\qboot\\version-pc.txt", Charset.defaultCharset());
        System.out.println("|  框架   |  版本  | 框架   |  版本  |");
        System.out.println("| --- | --- | --- | --- |");
        for (String line : lineList) {
            String name = line.substring(line.indexOf("\"") + 1, line.indexOf("\"", 2));
            String version = line.substring(line.indexOf(":") + 2, line.lastIndexOf("\""));
            if (index % 2 != 0) {
                System.out.print("|" + name + "   |   " + version);
            } else {
                System.out.println("|" + name + "   |   " + version + "  |");
            }
            index++;
        }
    }
}
